﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using Hotnet.Web.Utility;
using Hotnet.Entity.Enum;

namespace Hotnet.Web.Controllers.Front
{
	public class FrontBaseController : BaseController
	{
		private static log4net.ILog logger = log4net.LogManager.GetLogger("Error");
		public FrontBaseController()
		{

		}

		protected override void OnException(ExceptionContext filterContext)
		{
			logger.Error("程序错误", filterContext.Exception);
			filterContext.HttpContext.Response.Redirect("/Error/");
			filterContext.ExceptionHandled = true;
		}

		protected override void HandleUnknownAction(string actionName)
		{
			//记录404错误
			logger.Error(string.Format("{0} 页面未找到,404",actionName));
			this.ControllerContext.Controller.ViewData["HeadControl"] = new HeadControl() { SystemCategory = EnumSystemCategory.图片 };
			Response.StatusCode = 404;
			View("~/Views/Error/NotFound.aspx").ExecuteResult(this.ControllerContext);
		}

	}
}
